function[] = netcdf_ascii(nc_fname)

a = sum(daysinyear([1995:2006]))*24*60;
start_date = datenum(1995,1,1);
time_array_min = (datenum(1995,1,1): (1/(24*60)): datenum(2006,12,31,23,59,0))';

S1 = dir(nc_fname);

if ~isempty(S1),
ncid = netcdf.open(nc_fname,'NC_WRITE');
X_ID = netcdf.inqVarID(ncid,'X_secular_removed');
Y_ID = netcdf.inqVarID(ncid,'Y_secular_removed');
Z_ID = netcdf.inqVarID(ncid,'Z_secular_removed');
else,
    fprintf('Error in opening file\n');
    return;
end;

x_data = netcdf.getVar(ncid, X_ID, 0, a);
x_data = double(x_data)/10;


y_data = netcdf.getVar(ncid, Y_ID, 0, a);
y_data = double(y_data)/10;


z_data = netcdf.getVar(ncid, Z_ID, 0, a);
z_data = double(z_data)/10;

netcdf.close(ncid);

fid = fopen([nc_fname(1:3) '_X.txt'],'wt');
if fid ~= -1,
    fprintf(fid,'%7.1f\n',x_data);
    fclose(fid);
else,
    fprintf('Error in creating a file\n');
    return;
end; 


fid = fopen([nc_fname(1:3) '_Y.txt'],'wt');

if fid ~= -1,
    fprintf(fid,'%7.1f\n',y_data);
    fclose(fid);
else,
    fprintf('Error in creating a file\n');
    return;
end; 

fid = fopen([nc_fname(1:3) '_Z.txt'],'wt');

if fid ~= -1,
    fprintf(fid,'%7.1f\n',z_data);
    fclose(fid);
else,
    fprintf('Error in creating a file\n');
    return;
end; 


